import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static int[][] creatArray(){
        int[][] arr = {{1},{2,3},{4,8,9}};
        return arr;
    }

    public static void main(String[] args) {
        int[][] array = {{1},{2,3},{4,8,9}};
        for (int i = 0; i < array.length; i++) {
            System.out.println(Arrays.toString(array[i]));
        }
    }
    public static void print(int[][] array){
        for (int i = 0; i < array.length; i++) {
                System.out.println(Arrays.toString(array[i]));
            }
    }
    public static void main7(String[] args) {
        int[][] array = new int[4][];
        int[][] array2 = new int[][]{{1,2,3}, {4, 5, 6}};
        int[][] array3 = {{1,2},{3,4},{5,6}};
        System.out.println("array2:");
        print(array2);
        System.out.println("array3:");
        print(array3);
    }
    public static void number(int a){
        a += 10;
    }
    public static void main6(String[] args) {
        int a = 10;
        System.out.println(a);
    }
    public static int[] increase(int[] array){
        int[] arr = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            arr[i] = array[i] * 2;
        }
        return arr;
    }
    public static void main5(String[] args) {
        int[] arr = new int[]{1,2,3,4};
        System.out.println(Arrays.toString(arr));
        System.out.println("扩大两倍后:");
        int[] arr2 = increase(arr);
        System.out.println("arr数组："+Arrays.toString(arr));
        System.out.println("arr2数组："+Arrays.toString(arr2));
    }
    public static void func1() {
        int a = 10;
        int b = 20;
        int[] arr = new int[]{1,2,3};
    }
    public static void func2() {
        int[] array1 = new int[3];
        array1[0] = 10;
        array1[1] = 20;
        array1[2] = 30;

        int[] array2 = new int[]{1,2,3,4,5};
        array2[0] = 100;
        array2[1] = 200;

        array1 = array2;
        array1[2] = 300;
        array1[3] = 400;
        array2[4] = 500;
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }
    public static void main4(String[] args) {
        int[] arr;
        //arr = {1,2,3};
        //arr = new int[3];
        //arr = new int[10];
        /*int[] arr = new int[]{1,2,5,6,8,9,0};
        System.out.println(arr);*/
        /*for (int x: arr) {
            System.out.print(x+" ");
        }*/
        /*for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }*/
    }
    public static void main3(String[] args) {
        int[] arr1 = new int[10];
        System.out.println(Arrays.toString(arr1));
        /*int[] arr2 = new int[]{1,2,3,4,5,6};
        int[] arr3 = {1,2,3,4,5,6};*/
    }
    public static int findMoreNumber(int[] arr){
        int ret = 0;
        int count = 1;
        int n = arr.length / 2;
        for (int i = 0; i < arr.length; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                if(arr[i] == arr[j]){
                    count++;
                }
                if(count > n){
                    return arr[i];
                }
            }
            count = 1;
        }
        return ret;
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入数组大小");
        int n = scan.nextInt();
        System.out.println("请输入数组元素：");
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scan.nextInt();
        }
        int find = findMoreNumber(arr);
        System.out.println(find);
    }
    public static boolean ifOddNumber(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0){
                count = 1;
                for (int j = i; j < array.length; j++) {
                    if(array[j] % 2 != 0){
                        count++;
                    }
                    if(count == 3){
                        return true;
                    }else if(array[j] % 2 == 0){
                        break;
                    }
                }
            }
        }
        return false;
    }
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入数组的元素个数：");
        int num = scan.nextInt();
        int[] arr = new int[num];
        System.out.println("请输入数组元素：");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scan.nextInt();
        }
        boolean flag = ifOddNumber(arr);
        if(flag == true){
            System.out.println("存在连续三个元素是奇数的情况");
        }else{
            System.out.println("不存在连续三个元素是奇数的情况");
        }
    }
}
